<%-- 
    Document   : aulas
    Created on : 30-may-2012, 9:54:11
    Author     : Administrador
--%>

<%@page import="com.javabeans.Aula"%>
<%@include file="../../../../controlSession.jsp" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%
    List<Aula> aulas = (List<Aula>)request.getAttribute("aulas");
    String msg = "";
    if(request.getAttribute("msg") != null)
        msg = (String)request.getAttribute("msg");
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>SI-ESFM </title>
        <meta name="description" content="Derechos Reservados SI-ESFM." />
        <link rel="stylesheet" href="<%=s_path%>/css/styles.css" type="text/css" />
        <link rel="stylesheet" href="<%=s_path%>/css/menu/style.css" type="text/css" />
        <link rel="shortcut icon" href="<%=s_path%>/images/ico.png" type="image/png"/>
        <script type="text/javascript" src="<%=s_path%>/js/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/comun.js"></script>
        <script type="text/javascript">
            function nuevo(){
                // accion = 8 = form nuevo aula
                location.href = "Administracion?accion=8";
            }
            
            function editar(idAula){
                var sbody = "accion=10&idAula="+idAula;
                location.href = "Administracion?"+sbody;
            }
            
            function darBaja(idAula,nro){
                var sbody = "accion=12&idAula="+idAula+"&nro="+nro;
                location.href = "Administracion?"+sbody;
            }
        </script>
    </head>
    <body onload="showTime(<%=s_param%>)">
        <div id="top-wrap">
            <!-- cabeza principal -->
            <%@include file="../../../../head.jsp" %>
            
            <!-- cuerpo -->
            <div id="bodySpace">               
                <!-- aqui va la ruta -->
                <div class="clearfix" id="middle" style="position: absolute">
                    <!-- aqui va el arbol de entrada -->
                    <div id="breadcrumb"><!-- le da la forma de la imagen -->
                        <ul>
                        <li><a>Home</a></li>
                        <li><span style="color:#666">Administraci&oacute;n</span></li>
                        <li><span style="color:#666">Administraci&oacute;n General</span></li>
                        <li class="current-page"><span class="end"><span class="middle">Administraci&oacute;n de Aula</span></span></li>
                        </ul>                       
                    </div><!-- begin SIDEBAR FIRST -->
                </div>
                
                <div id="principal">
                    <!-- izquierda -->
                    <div class="cuerpo2y" style="border: 0px solid"><br/><br/><!-- estos break son necesarios ya q uso absolute en css  cuerpo izquierdo-->
                        <div class="izq">
                            <%@include file="../../../../bodyIzq.jsp" %>
                        </div>
                        <div class="medio" style="border: 0px solid">
                            <h2 class="decorado">Lista de Aulas</h2>
                            <%=(msg.length()>0)?"<p style='color:blue;text-align:center'>"+msg+"</p>":""%>
                            <center>
                            <table class="miReporte" style="width: 97%">
                                <tr>
                                    <td style="text-align: right"><input type="button" class="boton" value="Anadir Nueva Aula" onclick="nuevo()"/></td>
                                </tr>
                            </table>
                            <table class="tabla_decorado" style="width: 97%">
                                <thead>
                                    <tr><!--  -->
                                        <th width="5%" class="th_decoradoRowspan">Nro</th>
                                        <th width="35%" class="th_decoradoRowspan">UNIDAD ACAD&Eacute;MICA</th>
                                        <th width="5%" class="th_decoradoRowspan">Nro. AULA</th>
                                        <th width="35%" class="th_decoradoRowspan">DESCRIPCI&Oacute;N</th>
                                        <th width="20%" class="th_decoradoRowspan">ACCIONES</th>
                                    </tr>
                                </thead>
                                <tbody>
                            <%
                                int i = 1;
                                for(Aula a : aulas){
                            %>          
                                    <tr class="tr_decorado">
                                        <td class="th_decorado" style="text-align: center"><%=i%></td>
                                        <td class="th_decorado"><%=a.getFacultad().getNombre()%></td>
                                        <td class="th_decorado"><%=a.getNro()%></td>
                                        <td class="th_decorado"><%=a.getDescripcion()%></td>
                                        <td class="td_decoradoDerecha" style="text-align: center">
                                            <input type="button" value="Editar" onclick="editar(<%=a.getIdAula()%>)" class="botonRep" title="Pulsa aqui para editar aula"/>
                                            <input type="button" value="Dar Baja" onClick="darBaja(<%=a.getIdAula()%>,'<%=a.getNro()%>')" class="botonRep" title="Pulsa aqui para dar de baja el aula"/>
                                        </td>
                                        <td class="td_decoradoDerecha"></td>
                                    </tr>
                            <%      i++;
                                }
                                if(i == 1){
                                    out.write("<tr class='tr_decorado'>");
                                    out.write("     <td class='td_decorado' colspan='4' style='text-align:center'><p style='color:red'>No existen aulas registradas!<p></td>");
                                    out.write("</tr>");
                                }
                            %>
                                </tbody>
                            </table>
                            </center>
                        </div>
                    </div><!--end of leftPan-->
                    
                    <div class="yDer" style="border: 1px solid #ccc;">
                        <%@include file="../../../../publicidad.jsp" %>                       
                    </div><!--end of rightPan-->
                </div><!--end of content-wrapper-->
            </div><!--end of body-wrap-->
        </div>
    </body>
</html>


